package com.changgou.listener;

import com.changgou.service.ESManagerService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 监听添加索引库
 */
@Component
public class GoodsUpListener {

    @Autowired
    private ESManagerService esManagerService;

    @RabbitListener(queues = "search_add_queue")
    public void searchAdd(String spuId){
        System.out.println("接收到消息："+spuId);
        try {
            esManagerService.importDataToESBySpuId(spuId);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
